#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using tl = tuple < int, int, int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2010;
const int mod = 998244353;

int f[N][N], n, p[N], siz[N], fac[N];
vec G[N];

inline int upd(const int &x) { return x + (x >> 31 & mod); }

void dfs(int x) {
	f[x][0] = 1; siz[x] = 1;
	for(auto y : G[x]) {
		dfs(y);
		per(i, siz[x] - 1, 0) per(j, siz[y], 1) f[x][i + j] = upd(f[x][i + j] + 1ll * f[x][i] * f[y][j] % mod - mod);
		siz[x] += siz[y];
	}
	per(i, siz[x] - 1, 0) f[x][i + 1] = upd(f[x][i + 1] + 1ll * f[x][i] * (siz[x] - i - 1) % mod - mod);
	//cerr << x << " : "; rep(i, 0, siz[x]) cerr << f[x][i] << " "; cerr << endl;
}

int ans;

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in; rep(i, 2, n) p[i] = in, G[p[i]].pb(i);
	fac[0] = 1; rep(i, 1, n) fac[i] = 1ll * fac[i - 1] * i % mod;
	dfs(1); 
	rep(i, 0, n)
		if(i & 1) ans = upd(ans - 1ll * f[1][i] * fac[n - i] % mod);
		else ans = upd(ans + 1ll * f[1][i] * fac[n - i] % mod - mod);
	printf("%d\n", ans);
	return 0;
}
